package 基础篇.线程通信.同步锁通信;

/**
 * Created by Administrator on 2018/7/28 0028.
 */
public class DepositThread extends Thread{
    private Account account;
    private double depositAmount;

    public DepositThread(String name, Account account, double depositAmount) {
        super(name);
        this.account = account;
        this.depositAmount=depositAmount;
    }

    @Override
    public void run() {
        while (true){
            account.deposit(depositAmount);
            try {
                Thread.sleep(1000l);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
